﻿using Tisbi.LawFirm.DAL.Models;

namespace Tisbi.LawFirm.UI.ViewModel
{
    public class CourtTypesCRUDViewModel : BaseCRUDItemViewModel<CourtType>
    {
        public CourtTypesCRUDViewModel(CourtType model) : base(model)
        {
        }

        public string CourtTypeTitle
        {
            get { return Model.CourtTypeTitle; }
            set
            {
                Model.CourtTypeTitle = value;
                RaisePropertyChanged(() => CourtTypeTitle);
            }
        }

        public override string Error
        {
            get
            {
                return this["Title"];
            }
        }

        public override string this[string columnName]
        {
            get
            {
                string result = string.Empty;
                switch (columnName)
                {
                    case "CourtTypeTitle":
                        if (string.IsNullOrWhiteSpace(Model.CourtTypeTitle)) result = "Поле 'Название' обязательное";
                        break;
                }
                return result;
            }
        }
    }
}
